package com.ruoyi.access.mapper;

import com.ruoyi.access.domain.AccessControlRule;
import com.ruoyi.access.domain.UserAccessRequest;
import com.ruoyi.access.domain.AccessDecisionLog;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface AccessControlMapper {

    AccessControlRule selectRule(@Param("resourceType") String resourceType,
                                 @Param("resourceId") Long resourceId,
                                 @Param("action") String action);

    List<AccessControlRule> selectAllRules();

    AccessControlRule selectRuleById(@Param("ruleId") Long ruleId);

    int insertRule(AccessControlRule rule);

    int updateRule(AccessControlRule rule);

    int deleteRuleById(@Param("ruleId") Long ruleId);

    int insertUserRequest(UserAccessRequest request);

    int updateUserRequestStatus(@Param("requestId") Long requestId,
                                @Param("status") String status);

    int insertDecisionLog(AccessDecisionLog log);

    int revokePermission(@Param("permissionId") Long permissionId);

}
